public class Dog implements Speak{

    @Override
    public void speak() {
        System.out.println("狗叫");
    }

    String name;
    public Dog(){
        System.out.println("调用了无参的构造的方法");
    }

    public Dog(String name){
        this();
        this.name=name;
        System.out.println("调用了有参的构造的方法");

    }

    public static void main(String[] args) {

        Dog dog=new Dog("旺财");
        dog.speak();

    }

}

interface Speak{

    public  void speak();

}
